package playitas

class BeachHasServiceTagLib {

    static namespace = 'beach'


    def showText = { attrs ->
        def value = attrs.doc.get(attrs.value)
        if (value) {
            out << "<strong>$attrs.name</strong> $value<br/>"
        }

    }

  def showLocation= { attrs ->
      def provincia = attrs.doc.get("provincia")
      def localidad = attrs.doc.get("localidad")
      if (provincia && localidad) {
          out << "$localidad ($provincia)"
      }

  }

    def showService = { attrs ->
        def value = attrs.doc.get(attrs.value)

        if (value) {
            out << "$attrs.name"
            if (!attrs.noBr) {
                out << "<br/>"
            }
        } else if (attrs.noName) {
            out << attrs.noName
            out << "<br/>"
        }
    }


    def hasService = { attrs ->
        if ( attrs.servicio == "true" ) {
          out << attrs.siTiene
        } else {
          out << attrs.noTiene
        }


    }

  def ifHasService = { attrs, body ->
      if ( attrs.servicio == "true" ) {
        out << body
      }
  }

  def notHasService = { attrs, body ->
      if ( attrs.servicio == "false" ) {
        out << body
      }

  }

}
